#region Namespace References

using System;
using System.Collections;
using System.Collections.Generic;
using DynConDevCorp.OpenArch.SmartData.Interfaces;
using DynConDevCorp.OpenArch.SmartData.Interfaces.Attributes;
using DynConDevCorp.OpenArch.SmartData.Interfaces.EventArgClasses;

#endregion

namespace DynConDevCorp.OpenArch.SmartData.Interfaces
{
 
    /// <summary>
    /// Base class for all Smart Collections which have a Primary Key
    /// </summary>
    public interface ISmartCollection : ISmartBase, IEnumerable
    {
        #region Public Instance Properties

        /// <summary>
        /// Gets the count.
        /// </summary>
        /// <value>The count.</value>
        [Persist(IsXmlPersistable = false, IsDatabaseField = false)]
        ISmartField<int> Count { get; }
        /// <summary>
        /// Gets the collection class.
        /// </summary>
        /// <value>The collection class.</value>
        CollectionClassCategory CollectionClassCategory { get; }
        /// <summary>
        /// Gets the type of the item.
        /// </summary>
        /// <value>The type of the item.</value>
        Type ItemType { get; }

        #endregion

        #region Public Instance Methods

        /// <summary>
        /// Gets the items.
        /// </summary>
        /// <typeparam name="TReturn">The type Items in the returned IEnumarable.</typeparam>
        /// <returns></returns>
        IEnumerable<TReturn> GetItems<TReturn>() where TReturn : class, ISmartBase;

        /// <summary>
        /// Clears this instance.
        /// </summary>
        void Clear();

        #endregion

        #region All Other Members

        /// <summary>
        /// Occurs when [collection changed].
        /// </summary>
        event EventHandler<CollectionChangedEventArgs> CollectionChanged;

        #endregion
    }

    /// <summary>
    /// Type Safe Smart Collection.
    /// </summary>
    /// <typeparam name="TItem">The type Smart object contained in the collection.</typeparam>
    public interface ISmartCollection<TItem> : ISmartBase, IEnumerable<TItem>
        where TItem : ISmartBase
    {
        #region Public Instance Methods

        /// <summary>
        /// Adds the specified item.
        /// </summary>
        /// <param name="item">The item.</param>
        void Add(TItem item);

        /// <summary>
        /// Removes the specified item.
        /// </summary>
        /// <param name="item">The item.</param>
        /// <returns></returns>
        bool Remove(TItem item);

        /// <summary>
        /// Determines whether [contains] [the specified item].
        /// </summary>
        /// <param name="item">The item.</param>
        /// <returns>
        /// 	<c>true</c> if [contains] [the specified item]; otherwise, <c>false</c>.
        /// </returns>
        bool Contains(TItem item);

        #endregion
    }
}